package com.kyrioscraft.cloud.common.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author kyrioscraft
 * @Date 2018/12/12 9:55
 * @Description //TODO
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class RestResponse<T> {

    private Boolean ret = true;
    private String msg = "";
    T data;
    public RestResponse<T> data(T data) {
        this.data = data;
        return this;
    }

    public static RestResponse success () {
        return new RestResponse(true,"",null);
    }

    public static RestResponse success(Object data) {
        return new RestResponse(true,"",data);
    }

    public static RestResponse fail(String msg) {
        return new RestResponse(false,msg,null);
    }

    public static RestResponse success(Object data,String msg) {
        return new RestResponse(true,msg,data);
    }

    public static RestResponse fail(Object data,String msg) {
        return new RestResponse(true,msg,data);
    }

}
